package com.powerunion.datacollection.dao;

import java.sql.Connection;
import java.util.List;

import com.powerunion.datacollection.model.ActivityInfo;
import com.powerunion.datacollection.model.SubmissionWorkItem;


public interface SubmissionWorkItemDao {

	public boolean save(ActivityInfo activityInfo,String formId,Connection conn)  throws DaoException;
	
	/**
	 * 查找该用户当前的采集任务
	 * @param userCode
	 * @return
	 */
	public List findSubmissionWorkByUser(String userCode)  throws DaoException;
	
	/**
	 * 更新整个环节的报送明细状态
	 * @param state 状态值
	 * @param actId 环节id
	 * @return
	 */
	public boolean updateState(int state,String actId)  throws DaoException;
	/**
	 * 更新某个任务的报送明细状态
	 * @param state
	 * @param id
	 * @return
	 * @throws DaoException
	 */
	public boolean updateState4User(int state,String id) throws DaoException;
	
	public boolean suspendSubmissionWork(String procId) throws DaoException;
	
	public boolean resumeSubmissionWork(String procId) throws DaoException;
	
	/**
	 * 判断是否能提交报送数据到上级审批步骤
	 * @param actId
	 * @return
	 * @throws DaoException
	 */
	public boolean submissionRule(String actId) throws DaoException;
	
	public List findSubmissionWorkIdByActivityId(String activityId) throws DaoException;
	
	public int getActivityType(String actId) throws DaoException;
	
	public List findCompleteSubmissionWorkByUser(String userCode)throws DaoException;
	
	/**
	 * 获取该报送环节中的所有报送任务的id
	 * @param actId
	 * @return
	 * @throws DaoException
	 */
	public String getActAllSubWorkIds(String actId) throws DaoException;
	/**
	 * 
	 * @param procId 流程实例id
	 * @param actId  当currentOrParrent是1的时候表示是当前的采集步骤的id 当currentOrParrent是2的时候表示上级审批步骤的id
	 * @param currentOrParrent 判断是取当前的采集步骤上报的数据还是根据上级审批步骤来读取数据 1表示是当前的采集步骤 2表示上级审批步骤
	 * @return
	 * @throws DaoException
	 */
	public List getAllSubWorksByAct(String procId,String actId,int currentOrParrent) throws DaoException;
	
	public List findAllSubmissionWorkByUser(String userCode)
	throws DaoException;
	
	public SubmissionWorkItem getByKey(String id) throws DaoException;
	
	public boolean initSubWork(String userCode, ActivityInfo activityInfo,
			String formId) throws DaoException;
	
	public boolean saveByTransmit(SubmissionWorkItem swi,String receiveUsers) throws DaoException;
	/**
	 * 用于审批步骤保存修改上报的数据
	 * 获取原先上报的数据里的上报任务id提供给删除原先数据库里的上报数据的时候用
	 * @param procId 流程实例id
	 * @param actId  步骤id
	 * @param currentOrParrent 判断是当前上报任务还是该审批步骤所有的上报数据
	 * @param actType 上报任务类型 用于区分当前上报的步骤是审批步骤还是采集步骤
	 * @return
	 * @throws DaoException
	 */
	public List getAllSubWorksByAct(String procId, String actId,
			int currentOrParrent,int actType) throws DaoException;
	/**
	 * 判断该采集任务是否上报
	 * @param id
	 * @return
	 * @throws DaoException
	 */
	public boolean iSubWorkCommit(String id) throws DaoException;
	
	public int getState(String id) throws DaoException;

}
